package com.iefgames.cs.exception;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.iefgames.cs.manager.PopleManager;

public class DisconnectionException extends RuntimeException {
	
	private Log logger = LogFactory.getLog(DisconnectionException.class);
	
	public DisconnectionException(HttpServletRequest request,
			HttpServletResponse response) {
		
		String uuid = request.getParameter("uuid");
		
		if (PopleManager.get(uuid).getCometTime() > Long.parseLong(request.getParameter("timestamp"))) {
			return;
		}
	
		PopleManager.removePople(uuid);
		
		logger.info("remove comet. uuid is " + uuid);
	}
}
